package cn.szx.boot.cms.controller;

import cn.szx.boot.cms.bean.UserBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author jiangyl@szixing.cn
 * @date 2018/4/17 0017 下午 4:35
 * @visor
 */
@RequestMapping(value = "/user")
@Controller
public class LoginController  {

    @RequestMapping(value = "login_view")
    public String loginView(){
        return "/login/login";
    }

    @RequestMapping(value = "/login")
    @ResponseBody
    public String login(HttpServletResponse response, HttpServletRequest request, UserBean userBean){

        if(true){//登录成功
            request.getSession().setAttribute("_session_user",userBean);
            return "success";
        }else{
            return "false";
        }

    }

}
